package job.work.utils;

import java.util.Calendar;

/**
 * @Classname Times
 * @Description zzy
 * @Date 2020/7/29 11:16
 * @Created by Administrator
 */


public  final class Times {

    private static Calendar calendar = Calendar.getInstance();

    //获取当前年
    public  static int year() {
        return calendar.get(Calendar.YEAR);
    }

    //获取当前月
    public static int month() {
        return calendar.get(Calendar.MONTH) + 1;
    }

    //获取当前日
    public static int day() {
        return calendar.get(Calendar.DATE);
    }

    //获取当前小时
    public static int hour() {
        return calendar.get(Calendar.HOUR_OF_DAY);
    }

    //获取当前分钟
    public static int minute() {
        return calendar.get(Calendar.MINUTE);
    }

    //获取当前秒
    public static int second() {
        return calendar.get(Calendar.SECOND);
    }

    //获取当前本周第几天
    public static int dayOfWeek() {
        return calendar.get(Calendar.DAY_OF_WEEK);
    }

    //获取当前本月第几天
    public static int dayOfMonth() {
        return calendar.get(Calendar.DAY_OF_MONTH);
    }

    //获取当前本年第几天
    public static int dayOfYear() {
        return calendar.get(Calendar.DAY_OF_YEAR);
    }

}
